Introduction

This page explains how you can enable your Maven Xcode project to package the Xcode sources and the resolved binary dependencies into a zip archive. This archive could serve as source distribution. When unpackaged, it could be opened and compiled in the Xcode IDE without any further modifications.

The default content of the source archive contains the following files and folders:

  • src/xcode/** (or the directory specified by the Maven parameter xcode.sourceDirectory in you changed the default Xcode project location)
  • pom.xml
  • sync.info
  • target/bundles/**
  • target/headers/**
  • target/libs/**
  • target/xcode-deps/**

If some of the above listed files or folders do not exist they get ignored.

Packaging as part of regular Maven build

In order to add the source packaging to the normal Maven build you have to add the package-xcodeproj goal to your build configuration. Please add the following executions section to your pom.xml :

pom.xml
...
    <build>
       <plugins>
          <plugin>
             <groupId>com.sap.prd.mobile.ios.mios</groupId>
             <artifactId>xcode-maven-plugin</artifactId>
             <extensions>true</extensions>
             <executions>
                <execution>
                   <id>package-xcode-project</id>
                   <phase>package</phase>
                   <goals>
                      <goal>package-xcodeproj</goal>
                   </goals>
                </execution>
             </executions>  
          </plugin>
            ...
        </plugins>
    </build>
...
			

The build will additionally produce a <artifactId>-xcodeproj-with-deps.zip file.

Manual packaging from command line

If you want to create the source with dependency archive locally just call the following commands:

mvn initialize
mvn xcode:package-xcodeproj

You will find the <artifactId>-xcodeproj-with-deps.zip in the target folder.

Adding additional files and folders to the source archive

Use the additionalArchivePaths list parameter in order to add additional sources to the archive. If the path denotes a folder the folder content with all subfolders will be added. If the path points to a file only the file will be added. The provided paths are relative to the project base directory. If the paths do not exist the entry is ignored.

Example:

pom.xml
...
    <build>
       <plugins>
          <plugin>
             <groupId>com.sap.prd.mobile.ios.mios</groupId>
             <artifactId>xcode-maven-plugin</artifactId>
             <extensions>true</extensions>
             <configuration>
                <additionalArchivePaths>
                   <param>src/docs</param>
                   <param>target/versions.xml</param>
                </additionalArchivePaths>
             </configuration>
          </plugin>
            ...
        </plugins>
    </build>
...

Excluding files and folders from the source archive

Use the excludes list parameter in order to exclude some source files or folders from the archive. If the path denotes a folder, the folder content with all subfolders will be excluded. If the path points to a file, only the file will be excluded. The provided paths are relative to the project base directory. If the paths do not exist the entry is ignored.

Example:

pom.xml
...
    <build>
       <plugins>
          <plugin>
             <groupId>com.sap.prd.mobile.ios.mios</groupId>
             <artifactId>xcode-maven-plugin</artifactId>
             <extensions>true</extensions>
             <configuration>
                <excludes>
                   <param>*.tmp</param>
                   <param>*/tmp/*</param>
                   <param>src/xcode/excludeDir/*</param>
                   <param>src/xcode/doNotPackage.txt</param>
                </excludes>
             </configuration>
          </plugin>
            ...
        </plugins>
    </build>
...